<template>
    <el-card shadow="never" style="border: 0;">
        <yun-form
                :data="row"
                :columns="columns">
                <template #default>
                    {:token_field()}
                </template>
        </yun-form>
    </el-card>
</template>
<script>
    import form from "@components/Form.js";
    export default{
        components:{
            'YunForm':form
        },
        data:{
            type:'',
            columns:[],
            row:Yunqi.data.row
        },
        onLoad:function(options){
            this.type=options.type || 'Driver';
            this.init();
        },
        methods: {
            init:function (){
                let type='';
                if(this.type=='Driver'){
                    type='司机';
                }
                if(this.type=='Seller'){
                    type='销售';
                }
                this.columns=[
                    {field:"id",title:"ID",edit:"hidden"},
                    {field:"realname",title:type+"姓名",edit:"text",rules:"required"},
                    {field:"mobile",title:"手机号",edit:"text",rules:"required;mobile"},
                    {
                        field:"user_id",
                        title:"绑定用户",
                        edit:{form:"selectpage",url:"user/index/index",labelField:"nickname",keyField:"id"},
                    },
                    {field:"status",title:"状态",edit:"switch","searchList":{normal:"正常",hidden:"隐藏"}},
                ];
            },
            tabChange:function(e){
                this.type=e;
                this.init();
                this.$refs.fasttable.reset();
            }
        }
    }
</script>
<style>

</style>
